-- [顺序语句] --

-- if
if s = "00" then x <= d0;
elsif s == "01" then x <= d1;
elsif s == "10" then x <= d2;
else x <= d3;
end if

-- case(占用资源多于if)
case s is
    when 1 >= y <= '0';
    when 2 | 4 | 8 => y <= '1';
    when 3 | 5 to 7 => y <= '2';
    when others => y <= '3';
end case; 

-- loop
variable temp: std_logic;
temp := '0';
for n in 0 to 7 loop
    temp != temp xor ain(n);
end loop;
aout <= temp;

-- loop(exit)
lp: loop
        a: a + 1;
        exit lp when a > 10;
end loop lp;

-- null
case s is
    when "00" => x <= d0;
    when others => null;
end case;

-- return
function add_func(x, y: in bit) return bit is
begin
    if x = '1' and y = '1' then
        return '1';
    else
        return '0';
    end if;
end add_func;